package cn.supermarket.mapper;

import cn.supermarket.pojo.entity.OrderItem;
import cn.supermarket.pojo.entity.PurchaseOrders;

import cn.supermarket.pojo.vo.PurchaseOrdersVO;
import cn.supermarket.pojo.vo.SimpleOrderVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.List;

@Repository
public interface OrderMapper {
    /**
     * 生成订单
     * @param purchaseOrders
     */
    void insertOrder(PurchaseOrders purchaseOrders);

    /**
     * 添加商品到order_item
     * @param orderItems
     */
    void insertOrderItem(List<OrderItem> orderItems);

    /**
     * 根据订单编号查询订单
     * @param orderId
     * @param orderId
     * @return 返回订单信息
     */
    List<PurchaseOrdersVO> selectOrderById(Long orderId);
    /**
     * 根据订单日期查询订单
     * @param startTime
     * @param endTime
     * @return 返回订单信息
     */
    List<PurchaseOrdersVO> selectOrderByTime(@Param("startTime") LocalDateTime startTime,@Param("endTime")LocalDateTime endTime);
    /**
     *
     */
    /**
     * 根据采购商查询订单
     * @param purchaser
     * @return
     */
    List<SimpleOrderVO> selectOrderByPurchaser(String purchaser);
    /**
     * 根据订单编号修改订单信息
     * @return受影响行数
     */
    int updateOrderIsDisplay(@Param("orderId") Long orderId,@Param("isDisplay") Integer isDisplay,@Param("modifyName") String modifyName );

    /**
     * 根据订单编号修改订单是否锁定
     * @param orderId
     * @param isEnable
     * @return
     */
    int updateOrderIsEnable(@Param("orderId") Long orderId,@Param("isEnable") Integer isEnable,@Param("modifyName") String modifyName);

    int updateOrderIsCancel(@Param("orderId") Long orderId,@Param("isCancel") Integer isCancel,@Param("modifyName") String modifyName);










}
